package com.totem.base.enums;

import lombok.Getter;

import java.util.Objects;

@Getter
public enum SubscribeLevelEnum {
    NORMAL("NORMAL", 0),
    TALENT("TALENT", 2),
    KING("KING", 3),
    SUPREME("SUPREME", 4);

    private final String code;
    private final int value;

    SubscribeLevelEnum(String code, int value){
        this.code = code;
        this.value = value;
    }

    public static SubscribeLevelEnum byCode(String code) {
        for (SubscribeLevelEnum e: SubscribeLevelEnum.values()) {
            if (e.code.equalsIgnoreCase(code)) {
                return e;
            }
        }
        return null;
    }

    public static boolean isNormal(String code){
        return NORMAL.getCode().equalsIgnoreCase(code);
    }
    public static boolean isTalent(String code){
        return TALENT.getCode().equalsIgnoreCase(code);
    }
    public static boolean isKing(String code){
        return KING.getCode().equalsIgnoreCase(code);
    }
    public static boolean isSupreme(String code){
        return SUPREME.getCode().equalsIgnoreCase(code);
    }
}
